<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" lang="zh">
<head>
    <th:block th:include="include :: header('设备数值列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse hidden">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

       <div class="btn-group-sm" id="toolbar" role="group">
           <!--  <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:tVartriver10002023:add">
                 <i class="fa fa-plus"></i> 添加
             </a--
             <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
                shiro:hasPermission="system:tVartriver10002023:edit">
                 <i class="fa fa-edit"></i> 修改
             </a>
             <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
                shiro:hasPermission="system:tVartriver10002023:remove">
                 <i class="fa fa-remove"></i> 删除
             </a>
             <a class="btn btn-warning" onclick="$.table.exportExcel()"
                shiro:hasPermission="system:tVartriver10002023:export">
                 <i class="fa fa-download"></i> 导出
             </a>-->
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:tVartriver:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:tVartriver:remove')}]];
    var prefix = ctx + "system/tVartriver";

    $(function () {
        var options = {
            url: prefix + "/query   ",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "设备数值",
            showExport: true,
            pagination: false,
            columns: [{
                title: '序号',
                formatter: function (value, row, index) {
                    return $.table.serialNumber(index);
                }
            },
                {
                    field: 'id',
                    title: '记录id',
                    visible: false
                },
                {
                    field: 'parentName',
                    title: '&nbsp;&nbsp;&nbsp;&nbsp;温室&nbsp;&nbsp;&nbsp;&nbsp;',
                    visible: true
                },
                {
                    field: 'deviceId',
                    title: '设备id',
                    sortable: true,

                },
                {
                    field: 'manualControl',
                    title: '手动控制',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if ("0" === value){
                            return '<span class="badge badge-warning">否</span>'
                        }else if ("1" === value){
                            return '<span class="badge badge-primary">是</span>'
                        }

                    }
                },
                {
                    field: 'channel1',
                    title: '空气温度(channel)',
                    sortable: true
                },
                {
                    field: 'channel2',
                    title: '空气湿度(channe2)',
                    sortable: true
                },
                {
                    field: 'channel3',
                    title: '空气温度(channe3)',
                    sortable: true
                },
                {
                    field: 'channel4',
                    title: '空气湿度(channe4)',
                    sortable: true
                },
                {
                    field: 'channel5',
                    title: '土壤水分(channel5)',
                    sortable: true
                },
                {
                    field: 'channel6',
                    title: '土壤温度(channel6)',
                    sortable: true
                },
                {
                    field: 'channel7',
                    title: '土壤水分(channel7)',
                    sortable: true
                },
                {
                    field: 'channel8',
                    title: '土壤温度(channel8)',
                    sortable: true
                },
                {
                    field: 'channel17',
                    title: '雨量',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + (row.id ? row.id : -1) + "," + row.deviceId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>